package com.asp.constant;

import lombok.Data;

import java.util.ArrayList;
import java.util.List;
import java.util.regex.Pattern;

/**
 * author:          ndg
 * date:            2024/3/29
 */
@Data
public class SensitiveWordConstant {
    private final Pattern pattern;
    List<String> sensitiveWords = new ArrayList<>();

    public SensitiveWordConstant() {
        sensitiveWords.add("操");
        sensitiveWords.add("sb");
        sensitiveWords.add("nm");
        sensitiveWords.add("原神");
        sensitiveWords.add("fuck");
        sensitiveWords.add("学习");
        sensitiveWords.add("java");
        sensitiveWords.add("c");
        sensitiveWords.add("丁真");
        sensitiveWords.add("雪豹");
        sensitiveWords.add("ikun");
        sensitiveWords.add("lkun");
        sensitiveWords.add("ndg");
        sensitiveWords.add("哇真的是你啊");
        sensitiveWords.add("芝士雪豹");


        StringBuilder sb = new StringBuilder();
        for (String word : sensitiveWords) {
            sb.append("|").append(Pattern.quote(word));
        }
        String regex = sb.substring(1);  // 去掉开头的"|"
        pattern = Pattern.compile(regex, Pattern.CASE_INSENSITIVE);
    }
}
